<script>
  export default {
    name: 'MyAbout',
    //通过路由规则进入该组件时被调用
    beforeRouteEnter(to, from, next){
      console.log("进入about组件了")
      const token = localStorage.getItem("token");
      if (to.meta.isAuth) {
        if (token === '11111') {
          next();
        } else {
          alert("暂无权限查看")
        }
      } else {
        next();
      }
    },
    //通过路由规则离开该组件时被调用
    beforeRouteLeave(){
      console.log("离开about组件的一瞬间")
    },
  }
</script>

<template>
  <div>
    <h2>我是About的内容</h2>
  </div>
</template>

<style>

</style>